const path = require('path');
const webpack = require('webpack');
const Merge = require('webpack-merge')
const CommonConfig = require('./webpack.common.js');//引入开发环境配置文件

module.exports = Merge(CommonConfig,{
    devtool: 'cheap-module-eval-source-map',
    devServer: {
        contentBase: path.resolve(__dirname, 'dist'),
        hot: true,
        hotOnly: true
    },
    output: {
        filename: '[name].bundle.js'
    },
    plugins: [
        new webpack.DefinePlugin({
        'process.env.NODE_ENV': JSON.stringify('development') // 在编译的代码里设置了`process.env.NODE_ENV`变量
        }),
        new webpack.HotModuleReplacementPlugin(),
        new webpack.NamedModulesPlugin()
    ]
})